import java.util.*;
import java.text.*;
class Test2{
    public int a = 10;
    public int b = 20;
    public void num(int x) {
        System.out.println(x);
    }
}

class Test3 extends Test2{
    public int a = 20;
    public int c = 30;
    public void num(){
        System.out.println(super.b - super.a);
    }

    public static void main(String[] args) {
        Test3 s = new Test3();
        s.num();   //10
        s.num(20);   //20
    }
}
public class test__5_12 {
    protected String xm; //姓名，具有保护修饰符的成员变量
    protected int xh;//学号
    void setdata(String xm,int xh) //设置数据的方法
    {
        this.xm=xm;
        this.xh=xh;
    }
    public void print() //输出数据的方法
    {
        System.out.println(xm+", "+xh);
    }

    public static void main(String[] args) {
        
    }
    public static int count(String str,char  a){
        int count = 0;
        for (int i = 0; i < str.length(); i++){
            if (str.charAt(i) == a){
                count++;
            }
        }
        return count;
    }
    public static void main3(String[] args) {
        System.out.println(Math.round(4.6));
        System.out.println(Math.max(5, 6));
        System.out.println(Math.min(5, 6));
        System.out.println(Math.sqrt(4));
        System.out.println((int)(Math.random() * 10));
        System.out.println(Math.pow(4, 2));
        System.out.println(Math.log(10));
        System.out.println(Math.sin(1 / 6.0 * Math.PI));
    }
    public static void main1(String[] args) {
        int ret = count("Welcome", 'e');
        System.out.println("Welcome中e有" + ret + "个");
    }
    public static void main2(String args[])
    {
        Date today = new Date(); //当前日期和时间
        SimpleDateFormat sdf;
        sdf= new SimpleDateFormat("yyyy 年MM 月dd 日hh 时mm 分ss 秒 a EEEE");
        System.out.println("当前日期和时间: "+sdf.format(today));
        long hms = System.currentTimeMillis(); //当前时间的毫秒数
        System.out.println("当前时间的毫秒数="+hms);
        Date tomorrow = new Date(hms+24*60*60*1000);
        System.out.println("明天是"+sdf.format(tomorrow));
        Calendar now = Calendar.getInstance();
        int year =now.get(Calendar.YEAR); //年份
        int month=now.get(Calendar.MONTH)+1; //月份
        int day = now.get(Calendar.DATE); //日期
        System.out.print("今天是"+year+"年"+month+"月"+day+"日");
        int week = now.get(Calendar.DAY_OF_WEEK); //星期
        switch (week)
        {
            case 1: System.out.println(" 星期日");break;
            case 2: System.out.println(" 星期一");break;
            case 3: System.out.println(" 星期二");break;
            case 4: System.out.println(" 星期三");break;
            case 5: System.out.println(" 星期四");break;
            case 6: System.out.println(" 星期五");break;
            case 7: System.out.println(" 星期六");break;
        }
    }
}
